]> dgit.raspbian.org Git - qt6-tools.git/commitdiff
Look for zstd before Clang
authorPino Toscano <pino@debian.org>
Sun, 20 Sep 2026 15:04:07 +0000 (17:04 +0200)
committerPatrick Franz <deltaone@debian.org>
Sun, 20 Sep 2026 15:04:07 +0000 (17:04 +0200)
Last-Update: 2026-08-22
Forwarded: not-needed

The story is more or less the following:
- LLVM ships its own Findzstd cmake find module from 16; this module defines
  2 targets: zstd::libzstd_shared and zstd::libzstd_static
- libzstd ships a cmake config module that defines 3 targets:
  zstd::libzstd_shared, zstd::libzstd_static, and zstd::libzstd
- the libzstd config module assumes that if one target is defined, all of them
  are, as if the config module itself was already run (i.e. multiple
  "find_package(zstd)" in a cmake project)
- in qttools, Clang is searched first, which in turns requires LLVM, and then
  libzstd

More details here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1073480#47

As workaround, look for libzstd before Clang: this way the proper zstd cmake
targets are defined, and the Findzstd cmake find module shipped with LLVM will
use them just fine without redefining them.

This should most likely be fixed on LLVM side.

Gbp-Pq: Name cmake-find-zstd-before-clang.diff

configure.cmake
src/designer/src/lib/CMakeLists.txt

index 78d86b7616b08ab76ea21dc8be067bf8d82dcec5..8f7b5c5bf8455eb33c37a60c5b32aa373878b517 100644 (file)
@@ -6,6 +6,19 @@ include(${CMAKE_CURRENT_LIST_DIR}/src/qdoc/cmake/QDocConfiguration.cmake)
 
 #### Tests
 
+# HACK: look for libzstd before Clang/LLVM; this way all the right
+# libzstd cmake targets are defined, instead of the partial ones defined
+# by the Findzstd shipped with LLVM
+if(NOT TARGET WrapZSTD::WrapZSTD)
+    qt_find_package(WrapZSTD 1.3
+        PROVIDED_TARGETS
+            WrapZSTD::WrapZSTD
+            zstd::libzstd
+            zstd::libzstd_static
+            zstd::libzstd_shared
+    )
+endif()
+
 qt_find_package(WrapLibClang 8 PROVIDED_TARGETS WrapLibClang::WrapLibClang)
 qt_find_package_extend_sbom(TARGETS WrapLibClang::WrapLibClang
     PACKAGE_VERSION "${QT_LIB_CLANG_VERSION}"
index 9afc5405e4ff658089c85a011cba34b7772afea1..db048ad59beff64b35099e0984422024ed8accb1 100644 (file)
@@ -422,15 +422,6 @@ endif()
 if(TARGET zstd::libzstd_static)
     qt_internal_disable_find_package_global_promotion(zstd::libzstd_static)
 endif()
-if(NOT TARGET WrapZSTD::WrapZSTD)
-    qt_find_package(WrapZSTD 1.3
-        PROVIDED_TARGETS
-            WrapZSTD::WrapZSTD
-            zstd::libzstd
-            zstd::libzstd_static
-            zstd::libzstd_shared
-    )
-endif()
 
 qt_internal_extend_target(Designer CONDITION QT_FEATURE_zstd
     LIBRARIES